import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../components/login.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: login
  },
  {
    path: '/login',
    component: login
  }, {
    path: '/home',
    component: () => import('../components/home.vue'),
    redirect: '/Welcome',
    children: [
      // 用户列表
      {
        path: '/users',
        component: () => import('../views/users.vue')
      },
      // Welcome页面

      {
        path: '/Welcome',
        component: () => import('../components/Welcome.vue')
      },
      // 角色列表
      {
        path: '/roles',
        component: () => import('../views/roles.vue')
      },
      // 权限列表
      {
        path: '/rights',
        component: () => import('../views/rights.vue')
      },
      // 商品管理
      // 商品列表
      {
        path: '/goods',
        component: () => import('../views/goods.vue')
      },
      // 添加商品
      {
        path: '/add',
        component: () => import('../views/goods/add.vue')
        // ()=>import("../views/goods/add.vue")
      },
      // // 分类参数
      {
        path: '/params',
        component: () => import('../views/params.vue')
      },
      // // 商品分类
      {
        path: '/categories',
        component: () => import('../views/categories.vue')
      },
      // // 订单管理
      // // 订单列表
      {
        path: '/orders',
        component: () => import('../views/orders.vue')
      },
      // // 数据统计
      // // 数据报表
      {
        path: '/reports',
        component: () => import('../views/reports.vue')
      }

    ]
  }
]

const router = new VueRouter({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router
